package com.warrior.superdata.mysql.entity.dto;

import com.warrior.superdata.annotation.MysqlCheckInject;
import com.warrior.superdata.base.BaseDto;
import com.warrior.superdata.mysql.mapper.ApiInfoMapper;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * @Description:
 * @ClassName: com.warrior.wisdom.machine.room.mysql.entity.ApiInfo.java
 * @date: 2022/2/23 10:20
 * @author xujian
 */
@Data
@MysqlCheckInject(mapper = ApiInfoMapper.class)
public class ApiInfoDto extends BaseDto {

    @NotBlank(message = "接口名称不能为空")
    @ApiModelProperty(value = "接口名称")
    @MysqlCheckInject(uniqueField = "name")
    private String name;

    @NotBlank(message = "接口请求类型不能为空")
    @ApiModelProperty(value = "接口请求类型")
    @MysqlCheckInject(conditionUniqueField = {"method", "url"})
    private String method;

    @NotBlank(message = "请求url不能为空")
    @ApiModelProperty(value = "请求url")
    private String url;

    @ApiModelProperty(value = "数据源类型 1:mysql 2:es")
    private Integer datasourceType;

    @ApiModelProperty(value = "接口类型 0:查询 1:新增 2:更新 3:删除")
    private Integer operateType;

    @NotBlank(message = "数据源code不能为空")
    @ApiModelProperty(value = "数据源code")
    private String datasourceCode;

    @NotBlank(message = "数据库名称不能为空")
    @ApiModelProperty(value = "数据库名称")
    private String databaseName;

    //@NotBlank(message = "主表不能为空")
    @ApiModelProperty(value = "主表名称")
    private String mainTableName;

    @NotNull(message = "返回数据类型不能为空")
    @ApiModelProperty(value = "返回数据类型 0:单条数据 1:数组 2:分页")
    private Integer resultType;

    @NotNull(message = "是否导出接口类型不能为空")
    @ApiModelProperty(value = "是否导出接口 1:是 0:否")
    private Integer isExport;

    @NotNull(message = "是否自定义sql不能为空")
    @ApiModelProperty(value = "是否导出接口 1:是 0:否")
    private Integer isCustomizeSql;

}
